<!DOCTYPE html>
<html>
<head>
	<meta http-equiv="Content-type" content="text/html; charset=utf-8">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	
	<link rel="stylesheet" href="css/jquery.mobile-1.3.1.css" />
	
	<script type="text/javascript" src="js/jquery-1.9.1.js"></script>	
	<script type="text/javascript" src="js/jquery.mobile-1.3.0.js"></script>
	<script type="text/javascript" src="js/cordova-2.5.0.js" charset="utf-8" ></script>

	
	<script type="text/javascript" charset="utf-8">		

		
	
		function iniciar() {			
			document.addEventListener("deviceready", dispositivoListo, false);			
		}
		function dispositivoListo(){		
			document.addEventListener("online", isOnline, false);
			document.addEventListener("offline", isOffline, false);
		}
		function isOnline() {
			var d = new Date();
			$('#networkInfo').prepend("Online (" +	getConnectionTypeStr() + ")<br />");
		}
		function isOffline() {
			var d = new Date();
			$('#networkInfo').prepend("Offline <br />");
		}
		function getConnectionTypeStr() {		
			var states = {};
			states[Connection.UNKNOWN] = 'Unknown';
			states[Connection.ETHERNET] = 'Ethernet';
			states[Connection.WIFI] = 'Wi-Fi';
			states[Connection.CELL_2G] = 'Cell 2G';
			states[Connection.CELL_3G] = 'Cell 3G';
			states[Connection.CELL_4G] = 'Cell 4G';
			states[Connection.NONE] = 'No network';
			
			var networkState = navigator.network.connection.type;
			return states[networkState];
		}
	</script>
</head>

<body onload="iniciar()">

	<div data-role="page">
		<div data-role="header" data-position="fixed">		
			<h1>PI PhoneGap</h1>
		</div>
		
		<div data-role="content">
			<p>Ejemplo de Conexiones5</p>
			<p id="networkInfo"></p>
		</div>
		
		<div data-role="footer" data-position="fixed">
			<h1>RCondezo &copy; 2013</h1>
		</div>
	</div>
	
</body>

</html>